<template>
	<view>
		<u-navbar back-text="" back-icon-color="#FFFFFF" title-color="#FFFFFF" :background="{backgroundColor:'#3D75E9'}"
			title="维修安装">
			<view slot="right" class="nav-right" @click="toHistory()">
				历史记录
			</view>
		</u-navbar>
		<view class="mh-form">
			<view class="mh-form-title">
				<view class="mh-form-title-left">
					<view class="mh-form-title-color"></view>
					<view class="mh-form-title-txt">客户基本信息</view>
				</view>
			</view>
			<view class="mh-form-card">
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						客户名称：
					</view>
					<u-input v-model="formData.customer.name" placeholder="" height="40" disabled></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						联系人：
					</view>
					<u-input v-model="formData.customer.linkman" placeholder="" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						联系电话：
					</view>
					<u-input v-model="formData.customer.mobile" placeholder="" height="40"></u-input>
				</view>
				<view class="mh-form-item">
					<view class="mh-form-item-label width-140">
						客户地址：
					</view>
					<u-input v-model="formData.customer.address" placeholder="" height="40"></u-input>
				</view>
			</view>
			<view class="mh-form-title">
				<view class="mh-form-title-left">
					<view class="mh-form-title-color"></view>
					<view class="mh-form-title-txt">设备基本信息</view>
				</view>
			</view>
			<view class="mh-form-card">
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						设备名称：
					</view>
					<u-input v-model="formData.equipment.name" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						设备分类：
					</view>
					<u-input v-model="formData.equipment.categoryName" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						项目名称：
					</view>
					<u-input v-model="formData.equipment.projectName" placeholder="请输入" height="40" disabled></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						制造编号(出厂编号)：
					</view>
					<u-input v-model="formData.equipment.factoryCode" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						设备编号：
					</view>
					<u-input v-model="formData.equipment.code" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						生产厂家：
					</view>
					<u-input v-model="formData.equipment.factory" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						规格型号：
					</view>
					<u-input v-model="formData.equipment.model" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						设备位置：
					</view>
					<u-input v-model="formData.equipment.position" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						使用部门：
					</view>
					<u-input v-model="formData.equipment.deptName" placeholder="请输入" height="40" disabled></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-271">
						使用部门联系人：
					</view>
					<u-input v-model="formData.equipment.deptLinkman" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item">
					<view class="mh-form-item-label width-271">
						使用部门联系电话：
					</view>
					<u-input v-model="formData.equipment.deptMobile" placeholder="请输入" height="40"></u-input>
				</view>
			</view>
			<view class="mh-form-title">
				<view class="mh-form-title-left">
					<view class="mh-form-title-color"></view>
					<view class="mh-form-title-txt">维修安装单</view>
				</view>
				<view class="mh-form-title-right" @click="reset()">发起新维修/安装</view>
			</view>
			<view class="mh-form-card">
				<view class="mh-form-item-select border" @click="damageNatureShow = true">
					<view class="mh-form-item-label width-196">
						损坏性质：
						<view class="question" @click.stop="toLook()">
							<u-icon name="question-circle" size="28rpx" color="#3068E7"></u-icon>
						</view>
					</view>
					<view style="flex: 1;">{{showName(damageNatureList, formData.damageNature, 'name')}}</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view>
				<view class="mh-form-item-select border" @click="repairNatureShow = true">
					<view class="mh-form-item-label width-196">
						维修性质：
					</view>
					<view style="flex: 1;">{{showName(repairNatureList, formData.repairNature, 'name')}}</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view>
				<view class="mh-form-item-select border" @click="responsiblePersonShow = true">
					<view class="mh-form-item-label width-196">
						责任人：
					</view>
					<view style="flex: 1;">{{showName(userlist, formData.responsiblePerson, 'nickname')}}</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view>
				<view class="mh-form-item-select border" @click="repairInstallPersonShow = true">
					<view class="mh-form-item-label width-196">
						维修安装人员：
					</view>
					<view style="flex: 1;">{{showNames(userlist, formData.repairInstallPerson, 'id', 'nickname')}}
					</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view>
				<view class="mh-form-item-textarea border">
					<view class="mh-form-item-label width-196">
						维修安装内容：
					</view>
					<u-input v-model="formData.repairInstallContent" type="textarea" placeholder="请输入"></u-input>
				</view>
				<view class="mh-form-item-textarea border">
					<view class="mh-form-item-label width-196">
						维修安装结果：
					</view>
					<u-input v-model="formData.repairInstallResult" type="textarea" placeholder="请输入"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-196">
						维修安装工时：
					</view>
					<u-input v-model="formData.workHours" placeholder="请输入" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-196">
						是否更换元件：
					</view>
					<u-radio-group v-model="formData.componentReplacementFlag">
						<u-radio :name="1">是</u-radio>
						<u-radio :name="0">否</u-radio>
					</u-radio-group>
				</view>
				<view class="mh-form-item-textarea border" v-if="formData.componentReplacementFlag == 1">
					<view class="mh-form-item-label width-196">
						更换元器件：
					</view>
					<u-input v-model="formData.replacedComponent" type="textarea" placeholder="请输入"></u-input>
				</view>
				<view class="mh-form-item">
					<view class="mh-form-item-label width-196">
						是否完成：
					</view>
					<u-radio-group v-model="formData.completionFlag">
						<u-radio :name="1">是</u-radio>
						<u-radio :name="0">否</u-radio>
					</u-radio-group>
				</view>
				<view class="mh-form-item-textarea" v-if="formData.completionFlag == 0">
					<view class="mh-form-item-label width-196">
						维修安装进度：
					</view>
					<u-input v-model="formData.progress" type="textarea" placeholder="请输入"></u-input>
				</view>
			</view>
			<view class="mh-form-card" v-if="formData.completionFlag == 1">
				<view class="mh-form-item-textarea border">
					<view class="mh-form-item-label width-224">
						验收情况：
					</view>
					<u-input v-model="formData.postRepairAcceptance" type="textarea" placeholder="请输入"></u-input>
				</view>
				<view class="mh-form-item-select border" @click="openAcceptanceSignature()">
					<view class="mh-form-item-label width-224">
						验收人签字：
					</view>
					<view v-if="formData.acceptanceSignatureList.length > 0"
						@click.stop="$common.previewImg(formData.acceptanceSignatureList.map(item=>item.previewUrl), 0)">
						<u-image :src="formData.acceptanceSignatureList[0].previewUrl" width="150rpx"
							height="150rpx"></u-image>
					</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view>
				<!-- <view class="mh-form-item-select" @click="openDepartmentHeadSignature()">
					<view class="mh-form-item-label width-224">
						部门负责人签字：
					</view>
					<view v-if="formData.departmentHeadSignatureList.length > 0"
						@click.stop="$common.previewImg(formData.departmentHeadSignatureList.map(item=>item.previewUrl), 0)">
						<u-image :src="formData.departmentHeadSignatureList[0].previewUrl" width="150rpx"
							height="150rpx" @click=""></u-image>
					</view>
					<u-icon name="arrow-right" size="24" color="#999999"></u-icon>
				</view> -->
			</view>
			<view class="mh-form-card">
				<view class="mh-form-item-upload">
					<view class="mh-form-item-label width-224">
						维修前照片：
					</view>
					<view class="mh-form-item-upload-box">
						<view class="mh-form-item-upload-box-item" @click="chooseImage()">
							<u-image src="@/static/home/upload.png" width="150rpx" height="150rpx"></u-image>
						</view>
						<view class="mh-form-item-upload-box-item" v-for="(item, index) in formData.imagesList"
							:key="index"
							@click="$common.previewImg(formData.imagesList.map(item=>item.previewUrl), index)">
							<u-image :src="item.previewUrl" width="150rpx" height="150rpx"></u-image>
							<view class="mh-form-item-upload-box-item-close" @click="deleteImage(index)">
								<u-icon name="close-circle" color="#F56C6C" size="40"></u-icon>
							</view>
						</view>

					</view>
				</view>
			</view>
			<view class="mh-form-card" v-if="formData.completionFlag == 1">
				<view class="mh-form-item-upload">
					<view class="mh-form-item-label width-224">
						维修后照片：
					</view>
					<view class="mh-form-item-upload-box">
						<view class="mh-form-item-upload-box-item" @click="chooseImage1()">
							<u-image src="@/static/home/upload.png" width="150rpx" height="150rpx"></u-image>
						</view>
						<view class="mh-form-item-upload-box-item" v-for="(item, index) in formData.imagesList1"
							:key="index"
							@click="$common.previewImg(formData.imagesList1.map(item=>item.previewUrl), index)">
							<u-image :src="item.previewUrl" width="150rpx" height="150rpx"></u-image>
							<view class="mh-form-item-upload-box-item-close" @click="deleteImage1(index)">
								<u-icon name="close-circle" color="#F56C6C" size="40"></u-icon>
							</view>
						</view>

					</view>
				</view>
			</view>
			<view class="" style="padding: 80rpx 0;">
				<u-button type="primary" @click="repairSave()">提交</u-button>
			</view>
		</view>
		<u-select v-model="damageNatureShow" :list="damageNatureList" label-name="name" value-name="id"
			@confirm="damageNatureConfirm"></u-select>
		<u-select v-model="repairNatureShow" :list="repairNatureList" label-name="name" value-name="id"
			@confirm="repairNatureConfirm"></u-select>
		<!-- 签收人签字 -->
		<sign ref="acceptanceSignatureRef" @sign-data="acceptanceData"></sign>
		<!-- 部门负责人签字 -->
		<!-- <sign ref="departmentHeadSignatureRef" @sign-data="departmentData"></sign> -->
		<!-- 维修安装人员 -->
		<SearchPicker ref="single" static :multiple="true" :dataSource="userlist"
			:echoVal="formData.repairInstallPerson" :visible.sync="repairInstallPersonShow" keyName="nickname"
			target="id" @change="changeItem" />
		<!-- 责任人 -->
		<u-select v-model="responsiblePersonShow" :list="userlist" label-name="nickname" value-name="id"
			@confirm="responsiblePersonConfirm"></u-select>
	</view>
</template>

<script>
	import sign from '@/components/sign.vue'
	import SearchPicker from '@/components/stephenzhou-picker/stephenzhou-picker.vue'
	import {
		baseUrl
	} from '@/common/url'
	export default {
		components: {
			sign,
			SearchPicker
		},
		data() {
			return {
				action: baseUrl + '/attachment/upload',
				header: {},
				formData: {
					equipment: {},
					customer: {},
					equipmentId: '',
					repairInstallPerson: [],
					files: [],
					imagesList: [],
					imagesList1: [],
					componentReplacementFlag: 0,
					completionFlag: 1,
					acceptanceSignatureList: [],
					// departmentHeadSignatureList: [],
				},
				damageNatureShow: false,
				damageNatureList: [],
				repairNatureShow: false,
				repairNatureList: [],
				userlist: [],
				repairInstallPersonShow: false,
				responsiblePersonShow: false
			}
		},
		computed: {
			showName() {
				return (list, value, key) => {
					if (list.length > 0 && value) {
						return list.find(item => item.id == value)[key]
					} else {
						return ''
					}
				}
			},
			showNames() {
				return (list, value, key, name) => {
					if (list.length > 0 && value.length > 0) {
						return list.filter(item => value.includes(item.id)).map(item => item[
							name]).join(',')
					} else {
						return ''
					}
				}
			}
		},
		onLoad(option) {
			this.getDict()
			let token = uni.getStorageSync('token')
			// let tokenName = uni.getStorageSync('tokenName')
			this.header['yrt'] = token
			if (option.id || option.equipmentId) {
				this.formData.equipmentId = option.equipmentId
				if (option.id) {
					this.repairGetOne(option.id)
				} else {
					this.equipmentGetOne(1)
				}
			} else {
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.on('installationData', (data) => {
					this.$set(this, 'formData', data.data)
				})
			}
		},
		methods: {
			getDict() {
				this.$u.api.dictDamage().then(res => {
					this.damageNatureList = res
				})
				this.$u.api.dictRepair().then(res => {
					this.repairNatureList = res
				})
				this.$u.api.accountSelect().then(res => {
					this.userlist = res
				})
			},
			equipmentGetOne(type) {
				if (type == 1) {
					this.$u.api.getLastRepairInfo({
						id: this.formData.equipmentId
					}).then(res => {
						if (res.id) {
							res.imagesList = !res.files ? [] : res.files.filter(item => item.bizType ==
								'preRepairImage') || []
							res.imagesList1 = !res.files ? [] : res.files.filter(item => item.bizType ==
								'postRepairImage') || []
							res.acceptanceSignatureList = !res.files ? [] : res.files.filter(item => item
								.bizType ==
								'acceptanceSignature') || []
							res.repairInstallPerson = !res.repairInstallPerson ? [] : res.repairInstallPerson
							// res.departmentHeadSignatureList = !res.files ? [] : res.files.filter(item => item
							// 	.bizType == 'departmentHeadSignature') || []
							this.$set(this, 'formData', res)
						}

						this.$u.api.equipmentGetOne({
							id: this.formData.equipmentId
						}).then(ress => {
							this.$set(this.formData, 'customer', ress.customer)
							this.$set(this.formData, 'equipment', ress)
						})
					})
				} else {
					this.$u.api.equipmentGetOne({
						id: this.formData.equipmentId
					}).then(res => {
						this.$set(this.formData, 'customer', res.customer)
						this.$set(this.formData, 'equipment', res)
					})
				}
			},
			repairGetOne(id) {
				this.$u.api.repairGetOne({
					id
				}).then(res => {
					if (res.id) {
						res.imagesList = !res.files ? [] : res.files.filter(item => item.bizType == 'preRepairImage') || []
						res.imagesList1 = !res.files ? [] : res.files.filter(item => item.bizType == 'postRepairImage') ||
							[]
						res.acceptanceSignatureList = !res.files ? [] : res.files.filter(item => item.bizType ==
							'acceptanceSignature') || []
						res.repairInstallPerson = !res.repairInstallPerson ? [] : res.repairInstallPerson
						// res.departmentHeadSignatureList = !res.files ? [] : res.files.filter(item => item
						// 	.bizType == 'departmentHeadSignature') || []
						this.$set(this, 'formData', res)
						this.equipmentGetOne()
					} else {
						this.formData.id = id
						this.equipmentGetOne()
					}
				})
			},
			repairSave() {
				if (!this.validate()) {
					return false
				}
				let files = this.formData.imagesList.concat(this.formData.imagesList1).concat(this.formData
					.acceptanceSignatureList)
				// .concat(this
				// 	.formData.departmentHeadSignatureList)
				this.formData.files = this.formData.imagesList.concat(this.formData.imagesList1).concat(this.formData
					.acceptanceSignatureList)
				// .concat(this
				// 	.formData.departmentHeadSignatureList)
				uni.getNetworkType({
					success: (net) => {
						if (net.networkType === "none") {
							let temporaryList = uni.getStorageSync('temporaryList') || []
							if (this.formData.timestamp) {
								temporaryList.forEach(item => {
									if (item.timestamp == this.formData.timestamp) {
										item = this.formData
									}
								})
							} else {
								this.formData.timestamp = new Date().getTime()
								this.formData.submitFormType = 'installation'
								temporaryList.push(this.formData)
							}
							uni.setStorageSync('temporaryList', temporaryList)
							uni.showToast({
								icon: 'none',
								title: '无网络暂存成功，请记得提交！'
							})
							setTimeout(() => {
								uni.navigateBack()
							}, 1500)
						} else {
							uni.showLoading({
								title: '上传中...'
							})
							let submitList = []
							files.forEach((item, index) => {
								if (!item.fileByteSize) {
									submitList.push(this.submitUpload(item, index))
								}
							})
							Promise.all(submitList).then(() => {
								uni.getLocation({
									type: 'gcj02',
									geocode: true,
									success: locat => {
										const {
											province,
											city,
											district,
											street,
											streetNum,
											poiName
										} = locat.address
										this.formData.position = province + city +
											district + street + streetNum + poiName
										this.$u.api.repairSave(this.formData).then(res => {
											if (this.formData.timestamp) {
												let temporaryList = uni
													.getStorageSync(
														'temporaryList') || []
												temporaryList = temporaryList
													.filter(item =>
														item.timestamp != this
														.formData.timestamp
													)
												uni.setStorageSync('temporaryList',
													temporaryList)
											}
											uni.hideLoading()
											this.$u.toast('提交成功!')
											setTimeout(() => {
												uni.navigateBack()
											}, 1500)
										})
									},
									fail: () => {
										this.$u.api.repairSave(this.formData).then(res => {
											if (this.formData.timestamp) {
												let temporaryList = uni
													.getStorageSync(
														'temporaryList') || []
												temporaryList = temporaryList
													.filter(item =>
														item.timestamp != this
														.formData.timestamp
													)
												uni.setStorageSync('temporaryList',
													temporaryList)
											}
											uni.hideLoading()
											this.$u.toast('提交成功!')
											setTimeout(() => {
												uni.navigateBack()
											}, 1500)
										})
									}
								})

							})

						}
					}
				})
			},
			toHistory() {
				uni.navigateTo({
					url: '/pages/installation/history?equipmentId=' + this.formData.equipmentId
				})
			},
			reset() {
				Object.assign(this.formData, {
					id: null,
					damageNature: '',
					repairNature: '',
					responsiblePerson: '',
					repairInstallPerson: [],
					repairInstallContent: '',
					repairInstallResult: '',
					workHours: '',
					componentReplacementFlag: 0,
					replacedComponent: '',
					completionFlag: 1,
					progress: '',
					postRepairAcceptance: '',
					acceptanceSignature: '',
					departmentHeadSignature: '',
					acceptanceSignatureList: [],
					// departmentHeadSignatureList: [],
					imagesList: [],
					imagesList1: [],
					files: []
				})
			},
			damageNatureConfirm(e) {
				this.formData.damageNature = e[0].value
			},
			repairNatureConfirm(e) {
				this.formData.repairNature = e[0].value
			},
			responsiblePersonConfirm(e) {
				this.formData.responsiblePerson = e[0].value
			},
			openAcceptanceSignature() {
				this.$refs.acceptanceSignatureRef.open()
			},
			openDepartmentHeadSignature() {
				this.$refs.departmentHeadSignatureRef.open()
			},
			changeItem(e) {
				this.formData.repairInstallPerson = e.data.map(item => item.id)
			},
			async acceptanceData(filePath) {
				let path = await this.savePhoto(filePath)
				this.$set(this.formData, 'acceptanceSignatureList', [{
					bizType: 'acceptanceSignature',
					previewUrl: path
				}])
			},
			async departmentData(filePath) {
				let path = await this.savePhoto(filePath)
				this.$set(this.formData, 'departmentHeadSignatureList', [{
					bizType: 'departmentHeadSignature',
					previewUrl: path
				}])
			},
			chooseImage() {
				uni.chooseImage({
					sizeType: ['compressed'],
					count: 9,
					success: async (res) => {
						const savePhoto = (path, index) => {
							return new Promise((resolve, reject) => {
								uni.saveFile({
									tempFilePath: path,
									success: (ress) => {
										res.tempFiles[index].path = ress.savedFilePath
										resolve()
									}
								});
							})
						}
						let saveList = []
						res.tempFiles.forEach((item, index) => {
							saveList.push(savePhoto(item.path, index))
						})
						Promise.all(saveList).then(allres => {
							this.formData.imagesList = this.formData.imagesList.concat(res.tempFiles
								.map(
									item => {
										return {
											bizType: 'preRepairImage',
											previewUrl: item.path
										}
									}))
						})
					}
				})
			},
			chooseImage1() {
				uni.chooseImage({
					sizeType: ['compressed'],
					count: 9,
					success: async (res) => {
						const savePhoto = (path, index) => {
							return new Promise((resolve, reject) => {
								uni.saveFile({
									tempFilePath: path,
									success: (ress) => {
										res.tempFiles[index].path = ress.savedFilePath
										resolve()
									}
								});
							})
						}
						let saveList = []
						res.tempFiles.forEach((item, index) => {
							saveList.push(savePhoto(item.path, index))
						})
						Promise.all(saveList).then(allres => {
							this.formData.imagesList1 = this.formData.imagesList1.concat(res.tempFiles
								.map(
									item => {
										return {
											bizType: 'postRepairImage',
											previewUrl: item.path
										}
									}))
						})
					}
				})
			},
			deleteImage(index) {
				this.formData.imagesList.splice(index, 1)
			},
			deleteImage1(index) {
				this.formData.imagesList1.splice(index, 1)
			},
			//保存图片到相册，方便核查
			savePhoto(path) {
				return new Promise((resolve, reject) => {
					uni.saveFile({
						tempFilePath: path,
						success: (res) => {
							resolve(res.savedFilePath)
						}
					});
				})

			},
			submitUpload(item, index) {
				return new Promise((resolve, reject) => {
					uni.uploadFile({
						url: this.action,
						header: this.header,
						filePath: item.previewUrl,
						name: 'file',
						success: (response) => {
							let data = JSON.parse(response.data).data
							this.formData.files[index] = {
								...data,
								bizType: item.bizType
							}
							resolve()
						},
						error: (response) => {
							reject()
						},
					})
				})
			},
			validate() {
				let flag = true
				let rules = [{
					name: 'damageNature',
					message: '请选择损坏性质',
				}, {
					name: 'responsiblePerson',
					message: '请选择责任人',
				}, {
					name: 'repairInstallContent',
					message: '请输入维修、安装内容',
				}, {
					name: 'repairInstallResult',
					message: '请输入维修、安装结果',
				}, {
					name: 'workHours',
					message: '请输入维修、安装工时',
				}, {
					name: 'replacedComponent',
					name1: 'componentReplacementFlag',
					value: 1,
					message: '请输入更换元器件',
				}, {
					name: 'progress',
					name1: 'completionFlag',
					value: 0,
					message: '请输入进度',
				}, {
					name: 'postRepairAcceptance',
					name1: 'completionFlag',
					value: 1,
					message: '请输入验收情况',
				}, {
					name: 'imagesList',
					type: 1,
					message: '请上传维修前图片',
				}, {
					name: 'imagesList1',
					name1: 'completionFlag',
					value: 1,
					type: 1,
					message: '请上传维修后图片',
				}]
				for (var i = 0; i < rules.length; i++) {
					const item = rules[i]
					if (item.name1) {
						if (item.type == 1) {
							if (this.formData[item.name1] == item.value && this.formData[item.name].length == 0) {
								this.$u.toast(item.message)
								flag = false
								break;
							}
						} else {
							if (this.formData[item.name1] == item.value && !this.formData[item.name]) {
								this.$u.toast(item.message)
								flag = false
								break;
							}
						}
					} else {
						if (item.type == 1) {
							if (this.formData[item.name].length == 0) {
								this.$u.toast(item.message)
								flag = false
								break;
							}
						} else {
							if (!this.formData[item.name]) {
								this.$u.toast(item.message)
								flag = false
								break;
							}
						}

					}
				}
				return flag
			},
			toLook() {
				uni.navigateTo({
					url: '/pages/installation/question'
				})
			}
		}
	}
</script>
<style>
	page {
		background-color: #F5F7FA;
	}
</style>
<style lang="scss" scoped>
	.nav-right {
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 45rpx;
		margin-right: 45rpx;
	}
</style>